<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //数组的反转排序
      var arr = [11, 22, 33, 44, 55];
      console.log(arr.reverse());  //  55 44 33 22 11
      //sort 冒泡排序
      var arr1 = [1, 22, 3, 48, 5, 125, 7, 2];
      //升序
      var arr2 = arr1.sort(function (a, b) {
        return a - b;
      });
      console.log(arr2);
      //降序
      var arr3 = arr1.sort(function (a, b) {
        return b - a;
      });
      console.log(arr3);
    </script>
  </body>
</html>
